package com.test.threads.example02;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class TraditionalTimerTest3 {


    public static void main(String[] args) throws InterruptedException {
        class MyTimeTask extends TimerTask{

            @Override
            public void run() {
                System.out.println("bombing!");
                new Timer().schedule(new MyTimeTask(),2000);
            }
        }
        new Timer().schedule(new MyTimeTask(),2000);

        while (true){
            System.out.println(new Date().getSeconds());
            Thread.sleep(1000);
        }
    }


}
